home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
paslib.zip
/
PASLIB01.DOC
< prev
next >
Wrap
Text File
|
1986-05-22
|
24KB
|
507 lines
A. Introduction
The following is the documentation for the subprogram
library PASLIB01.INC which is now placed in the public
domain.
CAVEAT: much of this library is IBM and PC DOS specific.
It has been tested on both an IBM PC-1 and an IBM PC/AT with
monochrome, CGA, EGA, and Hercules boards but there are no
guarantees for any other machines.
Any comments or suggestions will be appreciated.
Robert B. Wooster
(203) 227-5588
(212) 310-5222
CIS: 72415,1602
Version 1 released 22 May 1986
B. Global Declarations
1. Constants
a) IsColor
a boolean set by InitMonitor depending upon whether the
machines switches are set for monochrome or color.
Also used in SwapMonitors, q.v.
b) MaxRow, MaxCol should be self-evident
c) Video attributes:
LO_V: low video, HI_V high (or normal) video,
RE_V: reverse video
d) Special key scan codes
for the use of these constants see the functions ugetc
and NextField
1) cursor control keys
SK_HM: Home SK_UP: up SK_PU: PgUp
SK_LE: left SK_RI: right
SK_EN: End SK_DN: down SK_PD: PgDn
SK_IN: Ins SK_DE: Del
2) function keys
SK_F1 to SK_F0
3) the Esc key : E_S_C
2. Types
a) chrset
b) string80: used as standard string type in most of the
routines
c) bigstring: for use when string80 isn't enough
d) regtype: fairly standard register declaration for use in
DOS function calls
e) datetype: a standard date type to handle dates from 1/2/60
to 12/31/2050
f) timetype: a standard type for handling times
g) scrntype & scrnptr: used in SaveScrn and RestoreScrn
3. Variables
a) EquipFlag: the location of the equipment flag set by POST on
IBM PCs
b) MonoScrn & ColorScrn: the addresses of the monochrome and CGA
screens
c) KeyStat: the key status byte used by the keyboard routines
d) SavedScrn: used by SaveScrn & RestoreScrn, q.v.
e) SplKey: a flag used by the keyboard input routines, q.v.
f) sdt: the current date according to the machine's clock;
initialized in InitSys
g) out: used by WhereOut, q.v.
h) To_LST: see WhereOut
i) EscFlag: see ugetc
C. Hardware control functions
1. InitMonitor procedure
a) function: sets IsColor flag according to the switch
setting at EquipFlag
b) syntax: InitMonitor;
c) returns: nothing
d) side effects: sets IsColor flag
e) notes: EquipFlag is set during boot according to the
hardware switch settings. In a two monitor
system this means that the monochrome monitor
will come up. EquipFlag can, however, be
reset by some external programs such as Bob
Starr's UTIL.EXE.
2. SwapMonitors procedure
a) function: this is to allow two monitor systems to move
back and forth between the monochrome and
color monitors.
b) Syntax: SwapMonitors;
c) returns: nothing
d) side effects: resets EquipFlag, and IsColor to their
opposite monitor settings
e) notes: if you return to the Turbo editor after
switching monitors an odd number of times,
the results can be unpredictable, i.e. your
machine will more or less hang.
3. SaveScrn procedure
a) function: saves current screen
b) syntax: SaveScrn
c) returns: nothing
d) side effects: moves screen contents to savedscrn
e) notes: used with restorescrn
f) calls: nothing
4. RestoreScrn procedure
a) function: restores saved screen
b) syntax: RestoreScrn
c) returns: nothing
d) side effects: moves saved screen to current screen
e) notes: used with savescrn
f) calls: nothing
5. InitSystem procedure
a) function: initialize system to standard
setup
b) syntax: InitSystem;
c) returns: nothing
d) side effects: IsColor flag and sdt are set and the standard
window configuration (Sec. G) is initialized
e) notes: See TEMPLATE.PAS for an example of its use
f) calls: InitMonitor, InitWindows, SysDate
D. Low-level Screen I/O
1. ugetc character function
a) function: get a character from the keyboard without
echo but with several side effects
b) syntax c := ugetc;
c) returns the character typed
d) side effects
1) if Control-C is typed the program halts
2) if a special key, i.e. a function or cursor control key, is
typed, a null character is returned and the global variable
SplKey is set to that key's scan code
e) notes: this is the workhorse of the input functions
discussed in section D
2. putc procedure
a) function: put a character on the screen with a
specified attribute at the current cursor
position
b) syntax putc(c,b) where c is a character and b is an
attribute byte.
c) returns nothing
d) side effects none, but note that the cursor is not moved
e) notes: uses direct screen addressing
3. aputc procedure
a) function: put a character c on the screen with
attribute b at column x and row y
b) syntax aputc(c,b,x,y)
c) returns nothing
d) side effects none, but note that the cursor is not moved
e) notes: uses direct screen addressing
E. Data I/O
1. GetUC character function
a) function: get an upper case character from the
keyboard if it is in OKSet, otherwise ring
bell until a character in OKSet is typed
b) syntax c := GetUC(default, OKSet)
c) returns an upper case character
d) side effects same as ugetc
e) notes: useful for menu selections
f) calls: ugetc
2. PutString procedure
a) function: put a string on the CRT at the indicated
position
b) syntax PutString(s,x,y)
c) returns nothing
d) side effects none
e) notes: writes a string80 but $V- parameter permits
sending any string
3. GetString procedure
a) function: get a string from the keyboard
b) syntax: GetString(s1,len,x,y,s2)
where s1 is the string returned as a
side effect
len is the maximum length of the string
x,y are the screen coordinates
s2 is the default string or ''
c) returns: nothing
d) side effects: If a string has been typed it is returned in
s1. If no string typed before a special
function key or <Enter> is typed s2 is
returned as s1. If a special function